<?php

use app\middleware\AdminCheck;
use think\facade\Route;

$namespace = '\app\admin\controller\\';
$Login = '\app\admin\controller\login\\';
$article = '\app\controller\admin\article\\';

//账号登录
Route::get('/', $Login . 'Login@show');
Route::any('accountVerify', $Login . 'Login@accountVerify');
//微信登陆
Route::any('WxScanCode', $Login . 'WxLogin@WxScanCode');
Route::any('getCodeStatus', $Login . 'WxLogin@getCodeStatus');

//workman 统计信息
Route::post('updateCount', $Login . 'Login@updateCount');

//微信公众号服务器认证(消息通知)
Route::any('WxMessageNotice', $Login . 'WxLogin@certification');
//微信公众号回调
Route::any('WxCallback', $namespace . 'Index@WxCallback');

//发送短信接口
Route::any('sendSmsCode', $namespace . 'Login@sendSmsCode');

//退出账号
Route::get('manage/signOut', $Login . 'Login@signOut');

/** 路由验证注 **/
Route::group('manage', function () use ($namespace) {
    //后台首页
    Route::post('/noticeBindUser', $namespace . 'Index@noticeBindUser');
    Route::get('/index', $namespace . 'Index@menu');
    Route::get('/home', $namespace . 'Index@home');

    //项目
    Route::group('projects', function () use ($namespace) {
        //商城
        $Shop = $namespace . 'projects\shop\\';
        Route::group('shop', function () use ($Shop) {
            //分类
            Route::get('/classify', $Shop . 'Classify@show');
            Route::post('/classify/list', $Shop . 'Classify@getList');
            Route::post('/classify/add', $Shop . 'Classify@add');
            Route::post('/classify/delete', $Shop . 'Classify@delete');
            Route::post('/classify/update', $Shop . 'Classify@update');
            //商品
            Route::get('/goods', $Shop . 'Goods@show');
            Route::post('/goods/list', $Shop . 'Goods@getList');
            Route::get('/goods/info', $Shop . 'Goods@info');
            Route::post('/goods/add', $Shop . 'Goods@add');
            Route::post('/goods/update', $Shop . 'Goods@update');
            Route::post('/goods/delete', $Shop . 'Goods@delete');
        });

        //文章管理
        $content = $namespace . 'projects\content\\';
        Route::group('content', function () use ($content) {
            Route::get('/classify', $content . 'Classify@show');
            Route::post('/classify/list', $content . 'Classify@getList');
            Route::post('/classify/add', $content . 'Classify@add');
            Route::post('/classify/update', $content . 'Classify@update');
            Route::post('/classify/delete', $content . 'Classify@delete');

            Route::get('/article', $content . 'Article@show');
            Route::post('/article/list', $content . 'Article@getList');
            Route::post('/article/info', $content . 'Article@info');
            Route::post('/article/add', $content . 'Article@add');
            Route::post('/article/update', $content . 'Article@update');
            Route::post('/article/delete', $content . 'Article@delete');


//            Route::get('/', $content . 'Article@show');
//            Route::post('/getList123', $content . 'Article@getList');
        });

        //视频
        $video = $namespace . 'projects\video\\';
        Route::group('video', function () use ($video) {
            //分类
            Route::get('/classify', $video . 'Classify@index');
            Route::post('/classify/list', $video . 'Classify@getList');
            Route::post('/classify/add', $video . 'Classify@add');
            Route::post('/classify/update', $video . 'Classify@update');
            Route::post('/classify/delete', $video . 'Classify@delete');

            Route::get('/index', $video . 'Video@show');
            Route::post('/getList', $video . 'Video@getList');
            Route::post('/add', $video . 'Video@add');
            Route::post('/update', $video . 'Video@update');
            Route::post('/delete', $video . 'Video@delete');
        });

        //音乐
        $music = $namespace . 'projects\music\\';
        Route::group('music', function () use ($music) {
            //分类
            Route::get('/classify', $music . 'Classify@show');
            Route::post('/classify/getList', $music . 'Classify@getList');
            Route::post('/classify/add', $music . 'Classify@add');
            Route::post('/classify/delete', $music . 'Classify@delete');
            Route::post('/classify/update', $music . 'Classify@update');

            Route::get('/index', $music . 'Song@show');
            Route::post('/getList', $music . 'Song@getList');
            Route::post('/add', $music . 'Song@add');
            Route::post('/update', $music . 'Song@update');
            Route::post('/delete', $music . 'Song@delete');
        });

    });


    Route::get('/chat', $namespace . 'Chat@index');  //聊天测试
    Route::post('/chat/sendMsg', $namespace . 'Chat@sendMsg');  //聊天测试
    Route::any('/chat/inputting', $namespace . 'Chat@inputting');  //正在输入
    Route::any('/chat/cancelInput', $namespace . 'Chat@cancelInput');  //取消输入
    Route::get('/home2', $namespace . 'Index@home2');

    //系统设置
    $system = $namespace . 'system\\';
    Route::group('system', static function () use ($system) {
        //网站信息
        Route::get('/website', $system . 'Website@show');
        Route::post('/website/update', $system . 'Website@update');

        //菜单
        Route::group('menu', static function () use ($system) {
            Route::get('/', $system . 'Menu@show');
            Route::post('/list', $system . 'Menu@getList');
            Route::post('/add', $system . 'Menu@add');
            Route::post('/update', $system . 'Menu@update');
            Route::post('/delete', $system . 'Menu@delete');
            Route::post('/getTreeList', $system . 'Menu@getTreeList');
        });

        //账号设置
        Route::group('admins', static function () use ($system) {
            Route::get('/', $system . 'Admins@show');
            Route::post('/getList', $system . 'Admins@getList');
            Route::post('/add', $system . 'Admins@add');
            Route::post('/update', $system . 'Admins@update');
            Route::post('/delete', $system . 'Admins@delete');
        });

        //角色
        Route::group('role', static function () use ($system) {
            Route::get('/', $system . 'Role@show');
            Route::post('/list', $system . 'Role@getList');
            Route::post('/add', $system . 'Role@add');
            Route::post('/update', $system . 'Role@update');
            Route::post('/delete', $system . 'Role@delete');
        });

        //个人设置
        Route::group('/myInfo', static function () use ($system) {
            Route::get('/', $system . 'MyInfo@show');
            Route::post('/update', $system . 'MyInfo@updateInfo');
            Route::get('/password', $system . 'MyInfo@MyPassword');
            Route::post('/password/update', $system . 'MyInfo@MyPassword');
            Route::get('/bindingWx', $system . 'MyInfo@bindingWx');
            //用户绑定
//            Route::get('/wxbind', $system . 'MyInfo@wxbind');
            Route::post('/userBind', $system . 'MyInfo@userBind');
            Route::post('/bindingStatus', $system . 'MyInfo@bindingStatus');
            Route::post('/userWxUnbind', $system . 'MyInfo@userWxUnbind');
        });


        //上传设置
        Route::group('upload', static function () use ($system) {
            Route::any('/token', $system . 'Upload@token');
            Route::any('/image', $system . 'Upload@image');
            Route::any('/video', $system . 'Upload@video');
            Route::any('/music', $system . 'Upload@music');
            Route::any('/delete', $system . 'Upload@delete');
        });
    });

    //用户管理
    $user = $namespace . 'users\\';
    Route::group('user', static function () use ($user) {

        Route::get('/', $user . 'User@show');
        Route::post('/getList', $user . 'User@getList');
        Route::post('/add', $user . 'User@add');
        Route::post('/update', $user . 'User@update');
        Route::post('/delete', $user . 'User@delete');

    });


})->middleware(AdminCheck::class);